package cn.sdormitory.component.bindValue.bean.info;

import cn.hutool.core.util.StrUtil;
import cn.sdormitory.common.utils.ContainerUtil;
import cn.sdormitory.component.bindValue.bean.target.StoreTarget;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.ArrayUtils;

@EqualsAndHashCode(callSuper = true)
@Data
public class StoreInfo extends AnnotationInfo<StoreTarget> {
    private String[] queryFields;

    public String[] getQueryColumns(String idFieldName) {
        String[] queryFields = ArrayUtils.add(this.queryFields, "id");
        return ContainerUtil.map(queryFields, StrUtil::toUnderlineCase).toArray(String[]::new);
    }
}
